#include "te_EventManager.h"

using namespace irr;

// Singleton management
// TODO: make this into a template
EventManager *EventManager::instance = NULL;

EventManager *EventManager::GetSingleton()
{
	if(!EventManager::instance)
	{
		EventManager::instance = new EventManager();
	}
	return EventManager::instance;
}

void EventManager::DestroySingleton()
{
	delete EventManager::instance;
}

// Default constructor/destructor
EventManager::EventManager()
{
}

EventManager::~EventManager()
{
}

// Event handler
bool EventManager::OnEvent(const SEvent &event)
{
	if(event.EventType == EET_GUI_EVENT)
	{
		// Pass it along to the game logic DLL
		exports->GUIEvent(event.GUIEvent.EventType, event.GUIEvent.Caller, event.GUIEvent.Element);
	}
	return false;
}